#include <iostream>
#include <string>

using namespace std;

class Animal{
public:
    Animal(){
        cout<<"new Animal"<<endl;
    }
    virtual ~Animal(){
        cout<<"delete Animal"<<endl;
    };
    virtual void sound()=0;
public:
    string name="jack";
};

class Dog : public Animal
{
public:
    Dog(){
        cout<<"new Dog"<<endl;
    }
    virtual ~Dog(){
        cout<<"delete Dog"<<endl;
    }
    void sound(){
        cout<<"wangwang"<<endl;
    }
};

class SheepDog : public Dog
{
public:
    SheepDog(){
        cout<<"new SheepDog"<<endl;
    }
    ~SheepDog(){
        cout<<"delete SheepDog"<<endl;
    }
};

class SledDog : public Dog
{
public:
    SledDog(){
        cout<<"new SeldDog"<<endl;
    }
    ~SledDog(){
        cout<<"delete SledDog"<<endl;
    }
};

class Cat : public Animal
{
public:
    Cat(){
        cout<<"new Cat"<<endl;
    }
    virtual ~Cat(){
        cout<<"delete Cat"<<endl;
    }
    void sound(){
        cout<<"miaomiao"<<endl;
    }
};

class GardenCat : public Cat
{
public:
    GardenCat(){
        cout<<"new GardenCat"<<endl;
    }
    ~GardenCat(){
        cout<<"delete GardenCat"<<endl;
    }
};

class Garfield : public Dog
{
public:
    Garfield(){
        cout<<"new Garfield"<<endl;
    }
    ~Garfield(){
        cout<<"delete Garfield"<<endl;
    }
};

int main(){
    SledDog a;
    GardenCat b;
    return 0;
}